# -*- coding: utf-8 -*-
__author__ = 'chen'

# import tensorflow as tf
# import numpy as np

# 转字典类型
s = [(1, 2), ('a', 'b'), ('c', 'd')]
print(dict(s))

# if条件数字不为0则为True，字符串不为空则为True;elif
var1 = 100
if var1:
    print("not 0 is True")

var2 = 'aa'
if var2:
    print("not null is True")

var1 = 0
if var1:
    print("0 is True")
else:
    print("0 is False")

# for循环
for a in range(0, 10):
    print(a)
for a in range(0, 10, 2):
    print(a)


# 函数
def changeValue(mylist):
    mylist.append("abc")
    return ("abc", 123)


l1 = [1, 2, 3, 4, 5]
result = changeValue(l1)
print(result)


def add(a, b=10):
    return a + b


print(add(2, 3))

# 匿名函数
add = lambda a, b: (a + b)

result = add(1, 2)
print(result)


def add(func, x, y):
    a = func(x, y)
    print(a)


func = lambda a, b: (a + b)
add(func, 1, 2)














